﻿using System;
using System.Collections.Generic;
using System.Text;
using ZLDC.Common.Estate;
using System.Data;

namespace ZLDC.Topo.BLL.Estate
{
    public class LookTelLogBLL
    {
                                                                                        public static string p_LookTelLog_insert(int housingId, int deptId, string dept, int lookerId, string looker, string lookerPost)
        {
            string outmsg = "";
            int newid = 0;

            using (_Database db = new _Database("estate"))
            {
                ZLDC.DAL.Estate.LookTelLogDAL.p_LookTelLog_insert(housingId, deptId, dept, lookerId, looker, lookerPost, out outmsg, out newid, db);
            }

            return outmsg;
        }

                                                                public static int LookTelCount(int housingId, int userid, int typeid)
        {
            int rows = 0;

            using (_Database db = new _Database("estate"))
            {
                rows = ZLDC.DAL.Estate.LookTelLogDAL.LookTelCount(housingId, userid, typeid, db);
            }

            return rows;
        }

                                                public static string p_LookTelLog_list(int housingid)
        {           
            DataTable dt = null;
            
            using (_Database db = new _Database("estate"))
            {
                dt = ZLDC.DAL.Estate.LookTelLogDAL.p_LookTelLog_list_table(housingid, db);
                            }

            _Json json = new _Json(dt, "yyyy-MM-dd HH:mm:ss");

                        return "{record:" + json.ToJson() + "}";
        }
        
    }
}
